package com.atwulidun.composite08;

public class CompositeDemo {
    public static void main(String[] args) {
        // 创建一个大学
        OrganizationComponent university = new University("屋里蹲大学", "省钱");
        // 创建两个学院
        OrganizationComponent college1 = new College("蹲着学学院", "腿麻");
        OrganizationComponent college2 = new College("坐着学学院", "屁股麻");
        // 给学院1创建三个系
        OrganizationComponent department1 = new Department("数据结构系", "实用");
        OrganizationComponent department2 = new Department("算法系", "烧脑");
        OrganizationComponent department3 = new Department("设计模式系", "经典");
        // 给学院2创建两个系
        OrganizationComponent department4 = new Department("leetcode系", "有趣");
        OrganizationComponent department5 = new Department("哔哩哔哩系", "宝藏");
        // 将系添加到学院里
        college1.add(department1);
        college1.add(department2);
        college1.add(department3);
        college2.add(department4);
        college2.add(department5);
        // 将学院添加到大学里
        university.add(college1);
        university.add(college2);

        // 打印出大学的所有院系
        university.print();
        // 打印出学院1的所有系
        college1.print();
    }
}
